import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    TextInput,
    TouchableOpacity,
    StatusBar,
} from 'react-native';

import {Navigator} from "react-native-deprecated-custom-components";
import * as Consts from "react-native-deprecated-custom-components/src/NavigatorSceneConfigs";

/**
 * 抽取的Navigator 需要传入rootRoute作为第一界面
 */
export default class MyNavigator extends Component{
    render(){
        return(
            <Navigator
                initialRoute={this.props.rootRoute}
                configureScene={(route) => {
                    let configure = Navigator.SceneConfigs.PushFromRight;
                    switch (route.configure) {
                        case Consts.FloatFromLeft:
                            configure = Navigator.SceneConfigs.FloatFromLeft;
                            break;
                        case Consts.FloatFromBottom:
                            configure = Navigator.SceneConfigs.FloatFromBottom;
                            break;
                    }
                    return {
                        ...configure,
                        gestures: {}//禁用滑动退出
                    };
                }}
                renderScene={(route, navigator) => {
                    // 从route对象中获取页面组件
                    var Minuit = route.component;
                    return (<Minuit
                        navigator={navigator} {...route.passProps}/>);
                }}
            ></Navigator>
        )
    }
}